package com.eastfair.venueservice.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.mapper.SuperMapper;
import com.eastfair.venueservice.dto.ServiceOrderDTO;
import com.eastfair.venueservice.entity.ServiceOrder;
import com.eastfair.venueservice.vo.ExhibitionSettlementVO;
import com.eastfair.venueservice.vo.ServiceOrderVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * Mapper 接口
 * 服务订单
 * </p>
 *
 * @author dq
 * @date 2022-09-28
 */
@Repository
public interface ServiceOrderMapper extends SuperMapper<ServiceOrder> {

    /**
     * 分页查询订单列表.
     *
     * @param paramPage    the param page
     * @param queryWrapper the query wrapper
     * @return the page
     */
    Page<ServiceOrderVO> listServiceOrderVOs(Page<ServiceOrder> paramPage,
                                             @Param(Constants.WRAPPER) QueryWrapper<ServiceOrder> queryWrapper);

    /**
     * 销售服务数量+订单数量
     * @param serviceOrderDTO
     * @return
     */
    Map<String, Object> queryNumOfOrderAndService(ServiceOrderDTO serviceOrderDTO);

    /**
     * 订单趋势
     * @param serviceOrderDTO
     * @return
     */
    List<Map<String, Object>> queryOrderTrend(ServiceOrderDTO serviceOrderDTO);

    /**
     * 订单趋势
     * @param serviceOrderDTO
     * @return
     */
    List<Map<String, Object>> queryOrderTrendByCreateTime(ServiceOrderDTO serviceOrderDTO);

    /**
     * 服务服务统计
     * @param serviceOrderDTO
     * @return
     */
    List<Map<String, Object>> queryCategoryStatistics(ServiceOrderDTO serviceOrderDTO);

    /**
     * 通过展会查询搭建商
     * @param exhibitionManageId
     * @return
     */
    List<ExhibitionSettlementVO> queryBuilder(@Param("exhibitionManageId") Long exhibitionManageId);

    /**
     * 查询订单的优惠金额
     * @param orderNumbers
     * @return
     */
    ServiceOrderVO queryTotalDiscountAmount(@Param("orderNumbers")  Set<String> orderNumbers);
}
